<template>
  <view class="padding-10">
    <view class="item" v-for="item in dataList" @click="goPage(item)">
      <image :src="item.imgUrl" mode="widthFix"/>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      dataList: [],
      a: {"list": [{"id": 0, "wxAppid": "", "imgUrl": "https://www.tejiawang.work/mini/elm.jpg", "path": ""}]},
    };
  },
  onLoad() {
    this.selectorQuery();
  },
  methods: {
    selectorQuery() {
      const _this = this;
      const vm = this;
      const url =
          getApp().globalData.version === 'release'
              ? 'https://www.tejiawang.work/qwhc/content.json?time='
              : 'https://www.tejiawang.work/qwhc/content_dev.json?time=';
      uni.request({
        url: url + new Date().getTime(),
        success: (res) => {
          vm.dataList = res.data.list;
        },
      });
    },
    goPage(item) {
      if (item.wxAppid) {
        uni.navigateToMiniProgram({
          appId: item.wxAppid,
          path: item.path,
          extraData: item.extraData || {},
        });
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.item {
  display: inline-block;
  margin-bottom:20rpx;
  width: 50%;
  border-radius: 10rpx;
  overflow: hidden;

  image {
    width: 100%;
  }
}
</style>
